<template>
  <view class="article"><rich-text :nodes="content"></rich-text></view>
</template>

<script>
let id;
export default {
  data() {
    return {
      content: ""
    };
  },
  onLoad(options) {
    id = parseInt(options.id);
    this.init();
  },
  methods: {
    init() {
      this.$api.news.getSingleArticle(id).then(_ => {
        uni.setNavigationBarTitle({
          title: _.data.data.title
        });
        this.content = _.data.data.content;
      });
    }
  },
  onPullDownRefresh() {
    this.init().then(_ => {
      uni.stopPullDownRefresh();
    });
  }
};
</script>

<style>
.article {
  width: 100%;
  min-height: 100%;
  background-color: #ffffff;
}
</style>
